package xyz.lne.researchgroupmanage.entity.neo4j;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Property;
import org.springframework.beans.BeanUtils;
import xyz.lne.researchgroupmanage.entity.Research;

/**
 * Designed By Lne.
 * 2021/3/2 16:54
 */
@NodeEntity(label = "research")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResearchNode {
    @Id
    @GeneratedValue
    private Long id;

    @Property(name = "name")
    private String name;

    @Property(name = "researchId")
    private Integer researchId;

    public static ResearchNode convertFromResearch(Research research){
        ResearchNode researchNode = new ResearchNode();
        BeanUtils.copyProperties(research, researchNode);
        return researchNode;
    }
}
